package com.library.weiget;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.View;
import android.widget.ImageView;

import com.jtjrenren.android.taxi.driver.R;

/**
 * Created by Administrator on 2016/3/3.
 */
public class CustomeLoaddingDlg extends Dialog {
    private ImageView iv_loadding;
    private AnimationDrawable anim;


    public CustomeLoaddingDlg(Context context, int theme) {
        super(context, theme);
        initView();
    }


    public CustomeLoaddingDlg(Context context) {
        super(context, R.style.dlg_common);
        initView();
    }

    private void initView() {
        View view = View.inflate(getContext(),
                R.layout.dlg_custome_loading, null);

        iv_loadding = (ImageView) view
                .findViewById(R.id.dlg_loadding_iv);

        setContentView(view);
    }

    @Override
    public void show() {
        super.show();
        anim = (AnimationDrawable) iv_loadding.getBackground();
        anim.start();
    }

    @Override
    public void dismiss() {
        super.dismiss();
        anim = (AnimationDrawable) iv_loadding.getBackground();
        anim.stop();
    }
}
